package com.vincent.dao;

import com.vincent.model.AdminMenu;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Vincent on 2014/12/30.
 */
@Repository("menuDao")
public class MenuDao {
    @Resource
    private AdminMenuMapper adminMenuMapper;

    public List<AdminMenu> selectAll(){
        return adminMenuMapper.selectAll();
    }

    public void saveMenu(AdminMenu menu){
        adminMenuMapper.insertSelective(menu);
    }

    public void udpateMenu(AdminMenu menu){
        adminMenuMapper.updateByPrimaryKeySelective(menu);
    }

    public AdminMenu getById(Integer id){
        return adminMenuMapper.selectByPrimaryKey(id);
    }

    public void deleteMenus(Integer []id){
        adminMenuMapper.deleteMenus(id);
    }
}
